﻿using System;
using System.Collections.Generic;
using Model.ModelEventArgs;

namespace Model.NotifyingCollections
{
    public class NotifyingStringHashMap : HashSet<String>
    {
        public event EventHandler<StringEventArgs> AddedItemEvent;
        public event EventHandler<StringEventArgs> RemovedItemEvent;

        public new bool Add(string item)
        {
            if(!base.Add(item))
                return false;
            if(AddedItemEvent != null)
                AddedItemEvent(this, new StringEventArgs{Body = item});
            return true;
        }

        public new bool Remove(string item)
        {
            if (!base.Remove(item))
                return false;
            if(RemovedItemEvent != null)
                RemovedItemEvent(this, new StringEventArgs{Body = item});
            return true;
        }

        public new void Clear()
        {
            throw new NotSupportedException();
        }

        public new int RemoveWhere(Predicate<String> predicate)
        {
            throw new NotSupportedException();
        }
    }
}